package org.igeek.config.bean.ch03;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;

import java.util.Arrays;

/**
 * @package org.igeek.config.ch03
 * @Description
 * @Author LittlePunk [296526219@qq.ccom]
 * @Version 2022.1
 * @Date 2023/11/13 16:35
 */
@ComponentScan("org.igeek.config.ch03")
public class FactoryBeanTest {
    public static void main(String[] args) {
        //创建ioc容器
        AnnotationConfigApplicationContext ac =
                new AnnotationConfigApplicationContext(FactoryBeanTest.class);
        //2.获取Bean
        String[] beanDefinitionNames = ac.getBeanDefinitionNames();
        System.out.println(Arrays.toString(beanDefinitionNames));

        //找到
        Object emp2 = ac.getBean("emp2");
        //emp2.getClass() = class org.igeek.config.ch03.Employee
        System.out.println("emp2.getClass() = " + emp2.getClass());
    }
}
